package com.lz.springboot.apollo.rabbit;

import java.io.IOException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import com.lz.springboot.rabbit.common.RabbitConstants;
import com.rabbitmq.client.Channel;

@Component
public class SimpleReceiver2{
	
	private static final Logger LOGGER = LoggerFactory.getLogger(SimpleReceiver2.class);
	
	@RabbitListener(queues = RabbitConfig.SPRINGBOOT_RABBIT_SIMPLE_QUEUE, containerFactory=RabbitConstants.FIRST_RABBIT_CONTAINER_FACTORY)
	public void on(Message message, Channel channel) throws IOException{
		channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
		LOGGER.info("SimpleReceiver2 收到消息 ={}", new String(message.getBody()));
	}
}
